<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/catethanh.css" />
<script type="text/javascript" src="catalog/view/theme/default/js/special.js"></script>
<div class="best-sell">
<?php //foreach ($products as $product) { $category_name = $product['category_name']; } ?>
  <div class="best-sell-title"><?php echo $heading_title;?></div> 
  <?php $thanhntt89 = 0; foreach ($products as $product){ $thanhntt89 ++;?>
                    <?php if($thanhntt89 == 1){?><ul><?php }?>
                    <?php if($thanhntt89 <= 3){?>
                        <li>
                            <div class="item-info">
                                <div class="name"><a href="<?php echo $product['href'];?>"><span><?php echo $product['name']; ?></span></a></div>
                                <div class="clear"></div>
                                <?php if ($product['price']) { ?>
                                <?php if (!$product['special']) { ?>
                                <div class="price" ><?php echo $product['price']; ?></div>
<!--                                <div class="old-price">&nbsp;</div>-->
                                <?php } else { ?>
                                <div class="price"><?php echo $product['special']; ?></div>
                                <div class="old-price"><?php echo $product['price']; ?></div>
                                <?php } ?>
                                <?php } ?>
                            </div>
                            <div class="avata"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
                        </li>
                        <?php }else{?>
                            <div class="clear"></div>
                            <?php if($thanhntt89 == 4){?>
                                <ul class="show-product1" style="overflow: hidden;height: 0px;">
                            <?php }?>
                            <li>
                                <div class="item-info">
                                    <div class="name"><a href="#"><span><?php echo $product['name']; ?></span></a></div>
                                    <div class="clear"></div>
                                    <?php if ($product['price']) { ?>
                                    <?php if (!$product['special']) { ?>
                                    <div class="price" ><?php echo $product['price']; ?></div>
                                    <?php } else { ?>
                                    <div class="price"><?php echo $product['special']; ?></div>
                                    <div class="old-price"><?php echo $product['price']; ?></div>
                                    <?php } ?>
                                    <?php } ?>
                                </div>
                                <div class="avata"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
                            </li>
                        <?php }?>
                    <?php if($thanhntt89 == 3){?></ul><?php }?>
                    <?php } ?>
                    </ul>
                    <div class="clear"></div>
                    <div class="btn-view-sell1 view1">
                        <span>&nbsp;</span>
                        <input type="button"  value="Xem thêm" />
                        <span>&nbsp;</span>
                    </div>
            
</div>
<script type="text/javascript">
    $('.btn-bu').bind('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/update',
		type: 'post',
		data: $(this).parent().find('input[type=\'text\'], input[type=\'hidden\']'),
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, information, .error').remove();
			
			if (json['error']) {
				if (json['error']['warning']) {
					$('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
				
					$('.warning').fadeIn('slow');
				}
				
				for (i in json['error']) {
					$('#option-' + i).after('<span class="error">' + json['error'][i] + '</span>');
				}
			}	 
						
			if (json['success']) {
				$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
					
				$('.success').fadeIn('slow');
					
				$('#cart_total').html(json['total']);
				
				$('html, body').animate({ scrollTop: 0 }, 'slow'); 
			}	
		}
	});
});
</script>
